import {request} from "@/network/request";

export function getDetail(iid){
  return request({
    url:'/detail',
    params:{
      iid
    }
  })
}

//获取推荐商品
export function getRecommend(){
  return request({
    url:'/recommend'
  })
}

//由于接口数据给API杂乱无章,所以,我们需要创建一个属于自己的对象
//商品的基本介绍类
export class Goods{
  constructor(iid,image,itemInfo,columns,services) {
    this.iid=iid;
    this.title=itemInfo.title;
    this.desc=itemInfo.desc;
    this.newPrice=itemInfo.price;
    this.oldPrice=itemInfo.oldPrice;
    this.discount=itemInfo.discountDesc;
    this.columns=columns;
    this.serivces=services;
    this.realPrice=itemInfo.lowNowPrice;
    this.image=image;
  }
}

//店家的介绍类
export class Shop {
  constructor(shopInfo) {
    this.logo=shopInfo.shopLogo;
    this.name=shopInfo.name;
    this.fans=shopInfo.cFans;
    this.sells=shopInfo.cSells;
    this.goodsCount=shopInfo.cGoods;
    this.score=shopInfo.score;
  }
}

//商品大小信息
export class GoodsParam{
  constructor(info,rule) {
    this.image=info.images?info.images[0]:'';
    this.infos=info.set;
    this.sizes=rule.tables;
  }
}
